#include <algorithm>
#include <iostream>
#include <queue>
#include <vector>

using ll = long long;

const int MAXN = 2505;

int n;
int m;
int k;
ll sc[MAXN];

std::vector<int> adj[MAXN];
int dist[MAXN][MAXN];

std::vector<int> pre[MAXN];

void bfs(int s) {
    std::queue<std::pair<int, int>> q;
    q.push({s, 0});
    dist[s][s] = 0;

    while (!q.empty()) {
        auto [u, d] = q.front();
        q.pop();
        if (d > k) {
            continue;
        }
        for (int v : adj[u]) {
            if (dist[s][v] == -1) {
                dist[s][v] = d + 1;
                q.push({v, d + 1});
            }
        }
    }
}

int main() {
    std::ios_base::sync_with_stdio(false);
    std::cin.tie(nullptr);

    std::cin >> n >> m >> k;

    for (int i = 2; i <= n; ++i) {
        std::cin >> sc[i];
    }

    for (int i = 0; i < m; ++i) {
        int u, v;
        std::cin >> u >> v;
        adj[u].push_back(v);
        adj[v].push_back(u);
    }

    for (int i = 1; i <= n; ++i) {
        for (int j = 1; j <= n; ++j) {
            dist[i][j] = -1;
        }
    }

    for (int i = 1; i <= n; ++i) {
        bfs(i);
    }

    for (int i = 2; i <= n; ++i) {
        for (int j = 2; j <= n; ++j) {
            if (i == j)
                continue;
            if (dist[1][j] != -1 && dist[j][i] != -1) {
                pre[i].push_back(j);
            }
        }
        std::sort(pre[i].begin(), pre[i].end(), [&](int a, int b) { return sc[a] > sc[b]; });
        if (pre[i].size() > 3) {
            pre[i].resize(3);
        }
    }

    ll ans = 0;
    for (int b = 2; b <= n; ++b) {
        for (int c = 2; c <= n; ++c) {
            if (b == c)
                continue;
            if (dist[b][c] != -1) {
                for (int a : pre[b]) {
                    for (int d : pre[c]) {
                        if (a != c && a != d && b != d) {
                            ans = std::max(ans, sc[a] + sc[b] + sc[c] + sc[d]);
                        }
                    }
                }
            }
        }
    }

    std::cout << ans << std::endl;
}
